home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir31 / acdkit10.zip / VBDOS.ZIP / CDDEMO.FRM < prev    next >
Text File  |  1994-11-01  |  11KB  |  480 lines

  1. Version 1.00
  2. BEGIN Form Cddemo
  3.     AutoRedraw   = 0
  4.     BackColor    = QBColor(7)
  5.     BorderStyle  = 1
  6.     Caption      = "CDDEMO"
  7.     ControlBox   = -1
  8.     Enabled      = -1
  9.     ForeColor    = QBColor(0)
  10.     Height       = Char(12)
  11.     Left         = Char(8)
  12.     MaxButton    = 0
  13.     MinButton    = 0
  14.     MousePointer = 0
  15.     Tag          = ""
  16.     Top          = Char(7)
  17.     Visible      = -1
  18.     Width        = Char(62)
  19.     WindowState  = 0
  20.     BEGIN Frame Frame1
  21.         BackColor    = QBColor(7)
  22.         Caption      = ""
  23.         DragMode     = 0
  24.         Enabled      = -1
  25.         ForeColor    = QBColor(0)
  26.         Height       = Char(7)
  27.         Left         = Char(0)
  28.         MousePointer = 0
  29.         TabIndex     = 5
  30.         Tag          = ""
  31.         Top          = Char(0)
  32.         Visible      = -1
  33.         Width        = Char(48)
  34.     END
  35.     BEGIN Label Label1
  36.         Alignment    = 0
  37.         AutoSize     = 0
  38.         BackColor    = QBColor(7)
  39.         BorderStyle  = 0
  40.         Caption      = "Audio Track(s):"
  41.         DragMode     = 0
  42.         Enabled      = -1
  43.         ForeColor    = QBColor(0)
  44.         Height       = Char(1)
  45.         Left         = Char(8)
  46.         MousePointer = 0
  47.         TabIndex     = 6
  48.         Tag          = ""
  49.         Top          = Char(2)
  50.         Visible      = -1
  51.         Width        = Char(16)
  52.     END
  53.     BEGIN Label Label2
  54.         Alignment    = 0
  55.         AutoSize     = 0
  56.         BackColor    = QBColor(7)
  57.         BorderStyle  = 0
  58.         Caption      = "Current Audio Time:"
  59.         DragMode     = 0
  60.         Enabled      = -1
  61.         ForeColor    = QBColor(0)
  62.         Height       = Char(1)
  63.         Left         = Char(4)
  64.         MousePointer = 0
  65.         TabIndex     = 7
  66.         Tag          = ""
  67.         Top          = Char(3)
  68.         Visible      = -1
  69.         Width        = Char(20)
  70.     END
  71.     BEGIN Label Label3
  72.         Alignment    = 0
  73.         AutoSize     = 0
  74.         BackColor    = QBColor(7)
  75.         BorderStyle  = 0
  76.         Caption      = "Total Audio Time:"
  77.         DragMode     = 0
  78.         Enabled      = -1
  79.         ForeColor    = QBColor(0)
  80.         Height       = Char(1)
  81.         Left         = Char(6)
  82.         MousePointer = 0
  83.         TabIndex     = 8
  84.         Tag          = ""
  85.         Top          = Char(4)
  86.         Visible      = -1
  87.         Width        = Char(18)
  88.     END
  89.     BEGIN Frame Frame2
  90.         BackColor    = QBColor(7)
  91.         Caption      = "Track"
  92.         DragMode     = 0
  93.         Enabled      = -1
  94.         ForeColor    = QBColor(0)
  95.         Height       = Char(5)
  96.         Left         = Char(24)
  97.         MousePointer = 0
  98.         TabIndex     = 9
  99.         Tag          = ""
  100.         Top          = Char(1)
  101.         Visible      = -1
  102.         Width        = Char(9)
  103.     END
  104.     BEGIN Frame Frame3
  105.         BackColor    = QBColor(7)
  106.         Caption      = "CD"
  107.         DragMode     = 0
  108.         Enabled      = -1
  109.         ForeColor    = QBColor(0)
  110.         Height       = Char(5)
  111.         Left         = Char(34)
  112.         MousePointer = 0
  113.         TabIndex     = 10
  114.         Tag          = ""
  115.         Top          = Char(1)
  116.         Visible      = -1
  117.         Width        = Char(9)
  118.     END
  119.     BEGIN CommandButton Button
  120.         BackColor    = QBColor(7)
  121.         Cancel       = 0
  122.         Caption      = "&Play"
  123.         Default      = 0
  124.         DragMode     = 0
  125.         Enabled      = -1
  126.         Height       = Char(3)
  127.         Index        = 0
  128.         Left         = Char(0)
  129.         MousePointer = 0
  130.         TabIndex     = 0
  131.         TabStop      = -1
  132.         Tag          = ""
  133.         Top          = Char(7)
  134.         Visible      = -1
  135.         Width        = Char(12)
  136.     END
  137.     BEGIN CommandButton Button
  138.         BackColor    = QBColor(7)
  139.         Cancel       = 0
  140.         Caption      = "&Stop"
  141.         Default      = 0
  142.         DragMode     = 0
  143.         Enabled      = -1
  144.         Height       = Char(3)
  145.         Index        = 1
  146.         Left         = Char(12)
  147.         MousePointer = 0
  148.         TabIndex     = 1
  149.         TabStop      = -1
  150.         Tag          = ""
  151.         Top          = Char(7)
  152.         Visible      = -1
  153.         Width        = Char(12)
  154.     END
  155.     BEGIN CommandButton Button
  156.         BackColor    = QBColor(7)
  157.         Cancel       = 0
  158.         Caption      = "P&ause"
  159.         Default      = 0
  160.         DragMode     = 0
  161.         Enabled      = -1
  162.         Height       = Char(3)
  163.         Index        = 2
  164.         Left         = Char(24)
  165.         MousePointer = 0
  166.         TabIndex     = 2
  167.         TabStop      = -1
  168.         Tag          = ""
  169.         Top          = Char(7)
  170.         Visible      = -1
  171.         Width        = Char(12)
  172.     END
  173.     BEGIN CommandButton Button
  174.         BackColor    = QBColor(7)
  175.         Cancel       = 0
  176.         Caption      = "&Next"
  177.         Default      = 0
  178.         DragMode     = 0
  179.         Enabled      = -1
  180.         Height       = Char(3)
  181.         Index        = 3
  182.         Left         = Char(36)
  183.         MousePointer = 0
  184.         TabIndex     = 3
  185.         TabStop      = -1
  186.         Tag          = ""
  187.         Top          = Char(7)
  188.         Visible      = -1
  189.         Width        = Char(12)
  190.     END
  191.     BEGIN CommandButton Button
  192.         BackColor    = QBColor(7)
  193.         Cancel       = 0
  194.         Caption      = "Pre&vious"
  195.         Default      = 0
  196.         DragMode     = 0
  197.         Enabled      = -1
  198.         Height       = Char(3)
  199.         Index        = 4
  200.         Left         = Char(48)
  201.         MousePointer = 0
  202.         TabIndex     = 4
  203.         TabStop      = -1
  204.         Tag          = ""
  205.         Top          = Char(7)
  206.         Visible      = -1
  207.         Width        = Char(12)
  208.     END
  209.     BEGIN CommandButton Button
  210.         BackColor    = QBColor(7)
  211.         Cancel       = 0
  212.         Caption      = "&Open"
  213.         Default      = 0
  214.         DragMode     = 0
  215.         Enabled      = -1
  216.         Height       = Char(7)
  217.         Index        = 5
  218.         Left         = Char(48)
  219.         MousePointer = 0
  220.         TabIndex     = 11
  221.         TabStop      = -1
  222.         Tag          = ""
  223.         Top          = Char(0)
  224.         Visible      = -1
  225.         Width        = Char(12)
  226.     END
  227.     BEGIN Label TrackStats
  228.         Alignment    = 0
  229.         AutoSize     = 0
  230.         BackColor    = QBColor(7)
  231.         BorderStyle  = 0
  232.         Caption      = "Label4"
  233.         DragMode     = 0
  234.         Enabled      = -1
  235.         ForeColor    = QBColor(0)
  236.         Height       = Char(1)
  237.         Index        = 1
  238.         Left         = Char(26)
  239.         MousePointer = 0
  240.         TabIndex     = 13
  241.         Tag          = ""
  242.         Top          = Char(3)
  243.         Visible      = -1
  244.         Width        = Char(6)
  245.     END
  246.     BEGIN Label TrackStats
  247.         Alignment    = 0
  248.         AutoSize     = 0
  249.         BackColor    = QBColor(7)
  250.         BorderStyle  = 0
  251.         Caption      = "Label4"
  252.         DragMode     = 0
  253.         Enabled      = -1
  254.         ForeColor    = QBColor(0)
  255.         Height       = Char(1)
  256.         Index        = 2
  257.         Left         = Char(26)
  258.         MousePointer = 0
  259.         TabIndex     = 14
  260.         Tag          = ""
  261.         Top          = Char(4)
  262.         Visible      = -1
  263.         Width        = Char(6)
  264.     END
  265.     BEGIN Label TrackStats
  266.         Alignment    = 0
  267.         AutoSize     = 0
  268.         BackColor    = QBColor(7)
  269.         BorderStyle  = 0
  270.         Caption      = "Label4"
  271.         DragMode     = 0
  272.         Enabled      = -1
  273.         ForeColor    = QBColor(0)
  274.         Height       = Char(1)
  275.         Index        = 0
  276.         Left         = Char(26)
  277.         MousePointer = 0
  278.         TabIndex     = 12
  279.         Tag          = ""
  280.         Top          = Char(2)
  281.         Visible      = -1
  282.         Width        = Char(6)
  283.     END
  284.     BEGIN Label cdStats
  285.         Alignment    = 0
  286.         AutoSize     = 0
  287.         BackColor    = QBColor(7)
  288.         BorderStyle  = 0
  289.         Caption      = "Label4"
  290.         DragMode     = 0
  291.         Enabled      = -1
  292.         ForeColor    = QBColor(0)
  293.         Height       = Char(1)
  294.         Index        = 2
  295.         Left         = Char(36)
  296.         MousePointer = 0
  297.         TabIndex     = 17
  298.         Tag          = ""
  299.         Top          = Char(4)
  300.         Visible      = -1
  301.         Width        = Char(6)
  302.     END
  303.     BEGIN Label cdStats
  304.         Alignment    = 0
  305.         AutoSize     = 0
  306.         BackColor    = QBColor(7)
  307.         BorderStyle  = 0
  308.         Caption      = "Label4"
  309.         DragMode     = 0
  310.         Enabled      = -1
  311.         ForeColor    = QBColor(0)
  312.         Height       = Char(1)
  313.         Index        = 1
  314.         Left         = Char(36)
  315.         MousePointer = 0
  316.         TabIndex     = 16
  317.         Tag          = ""
  318.         Top          = Char(3)
  319.         Visible      = -1
  320.         Width        = Char(6)
  321.     END
  322.     BEGIN Label cdStats
  323.         Alignment    = 0
  324.         AutoSize     = 0
  325.         BackColor    = QBColor(7)
  326.         BorderStyle  = 0
  327.         Caption      = "Label4"
  328.         DragMode     = 0
  329.         Enabled      = -1
  330.         ForeColor    = QBColor(0)
  331.         Height       = Char(1)
  332.         Index        = 0
  333.         Left         = Char(36)
  334.         MousePointer = 0
  335.         TabIndex     = 15
  336.         Tag          = ""
  337.         Top          = Char(2)
  338.         Visible      = -1
  339.         Width        = Char(6)
  340.     END
  341.     BEGIN Timer RefreshMe
  342.         Enabled      = -1
  343.         Interval     = 100
  344.         Left         = Char(0)
  345.         Tag          = ""
  346.         Top          = Char(0)
  347.     END
  348. END
  349. DEFINT A-Z
  350. REM $DYNAMIC
  351.  
  352. REM $INCLUDE: '.\ACDKIT.BI'
  353.  
  354. DECLARE FUNCTION TimeStr$ (BYVAL mins%, BYVAL secs%)
  355. DECLARE SUB UpdateDisplay ()
  356.  
  357. CONST FALSE% = 0
  358. CONST TRUE% = NOT FALSE%
  359.  
  360. DIM SHARED tracklist() AS trackinfo      ' music track information array
  361. DIM SHARED cd AS cdInfoTYPE              ' track info
  362. DIM SHARED cddrive AS INTEGER            ' first cdrom drive
  363. DIM SHARED curTrack AS INTEGER           ' current track number
  364.  
  365. SUB Button_Click (index AS INTEGER)
  366.  
  367.     DEFINT A-Z
  368.  
  369.     SELECT CASE index
  370.  
  371.         CASE 0
  372.             cdPlay cddrive%, curTrack, 99, tracklist()
  373.             Button(2).caption = "P&ause"
  374.  
  375.         CASE 1
  376.             cdStop cddrive%
  377.             Button(2).caption = "P&ause"
  378.  
  379.         CASE 2
  380.             IF (cd.status AND CDPAUSED) = CDPAUSED THEN
  381.                 cdResume cddrive%
  382.                 Button(2).caption = "P&ause"
  383.             ELSE
  384.                 cdPause cddrive%
  385.                 Button(2).caption = "&Resume"
  386.             END IF
  387.  
  388.         CASE 3
  389.             curTrack = curTrack MOD UBOUND(tracklist) + 1
  390.             cdPlay cddrive%, curTrack, 99, tracklist()
  391.             Button(2).caption = "P&ause"
  392.  
  393.         CASE 4
  394.             curTrack = curTrack - 1
  395.             IF curTrack = 0 THEN
  396.                 curTrack = UBOUND(tracklist)
  397.             END IF
  398.             cdPlay cddrive%, curTrack, 99, tracklist()
  399.             Button(2).caption = "P&ause"
  400.  
  401.         CASE 5
  402.             IF (cd.status AND CDOPEN) = CDOPEN THEN
  403.                 cdDoor cddrive%, 2
  404.                 Button(5).caption = "&Close"
  405.             ELSE
  406.                 cdStop cddrive%
  407.                 cdDoor cddrive%, 1
  408.                 Button(5).caption = "&Open"
  409.             END IF
  410.             Button(2).caption = "P&ause"
  411.  
  412.     END SELECT
  413.  
  414. END SUB
  415.  
  416. SUB Form_Load ()
  417.  
  418.     DEFINT A-Z
  419.  
  420.     REDIM tracklist(0) AS trackinfo         ' music track information array
  421.  
  422.     curTrack = 1
  423.  
  424.     IF IsMscdex = FALSE THEN
  425.         MSGBOX "MSCDEX.EXE driver is not installed.", 0, "Error"
  426.         END
  427.     END IF
  428.  
  429.     cddrive = GetFirstCdrom%                ' get the first cdrom drive
  430.  
  431.     dummy% = cdMediaChanged(cddrive%)       ' clear changed flag
  432.  
  433. RESTART:
  434.  
  435.     CLS
  436.  
  437.     IF IsAudio(cddrive) = FALSE THEN        ' is this an audio cd?
  438.         MSGBOX "The inserted cd is not an audio cd." + CHR$(13) + CHR$(10) + "Please insert an audio cd and restart.", 0, "Error"
  439.         END
  440.     END IF
  441.  
  442.     cdInit cddrive%, tracklist()             ' read cd information
  443.  
  444.     IF (cd.status AND CDPLAYING) <> CDPLAYING THEN
  445.         cdSeek cddrive%, 1, tracklist()     ' seek to first song
  446.     END IF
  447.  
  448. END SUB
  449.  
  450. SUB RefreshMe_Timer ()
  451.  
  452.     DEFINT A-Z
  453.  
  454.     cdGetInfo cddrive%, 0, cd, tracklist()
  455.  
  456.     curTrack = cd.track
  457.  
  458.     trackStats(0).caption = LTRIM$(STR$(cd.track))
  459.     trackStats(1).caption = TimeStr$(cd.TrackMin, cd.TrackSec)
  460.     trackStats(2).caption = TimeStr$(cd.TrackMins, cd.TrackSecs)
  461.  
  462.     cdStats(0).caption = LTRIM$(STR$(UBOUND(tracklist)))
  463.     cdStats(1).caption = TimeStr$(cd.cdMin, cd.cdSec)
  464.     cdStats(2).caption = TimeStr$(cd.cdMins, cd.cdSecs)
  465.     
  466. END SUB
  467.  
  468. FUNCTION TimeStr$ (BYVAL mins%, BYVAL secs%)
  469.  
  470.     IF secs% = 254 THEN
  471.         secs% = 0
  472.     END IF
  473.  
  474.     text$ = RIGHT$("00" + LTRIM$(STR$(mins%)), 2) + ":" + RIGHT$("00" + LTRIM$(STR$(secs%)), 2)
  475.  
  476.     TimeStr$ = text$
  477.  
  478. END FUNCTION
  479.  
  480.